<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/


//后台路由
	//后台登录
	Route::get('admin/login','Admin\LoginController@index');

	//登录处理
	Route::post('admin/check','Admin\LoginController@check');

	//验证码
	Route::get('/code','CodeController@index');

	//后台退出
	Route::get('admin/loginout','Admin\LoginController@loginout');


	// 文件上传路由
	Route::any("/admin/shangchuan","Admin\CommonController@upload");

	// 清除缓存
	Route::get("/admin/flush","Admin\IndexController@flush");


	//分组 前缀admin  域名admin
    Route::group(['namespace'=>'Admin','prefix'=>'admin','middleware'=>'adminLogin'],function(){
	//首页

     Route::get('/','IndexController@index');

     //管理员管理路由
	 Route::resource('admin','AdminController');

		 // 后台管理员状态修改路由
		Route::post('admin/ajaxStatu','AdminController@ajaxStatu');

		//管理员密码修改
		Route::get('admin/chang/{id}','AdminController@chang');
		
		Route::post('admin/changps','AdminController@changPwd');
		
		Route::post('admin/ajaxAuthority','AdminController@ajaxAuthority');

	//会员管理

	Route::resource('user','UserController');

	 // 后台分类管理
	Route::resource('types','TypesController');


	 // 后台分类标签管理
	Route::resource('tags','TagsController');


	// 后台商品管理
	Route::resource('goods','GoodsController');

	Route::get('goods/szy/{id}/{tid}','GoodsController@edi');

	// 后台商品上下架状态修改路由
	Route::post('/goods/ajaxSale','GoodsController@ajaxSale');


	// 后台订单管理

		Route::get('orders',"OrdersController@index");

			// 查看订单详情
			Route::get("orders/list","OrdersController@lists");

			// 查看收货地址
			Route::get("orders/addr/{id}","OrdersController@addr");

			// 修改订单状态 any 可也get post
			Route::any("orders/edit","OrdersController@edit");

			// 订单状态
			Route::get("orders/statu","OrdersController@statuList");
			
			Route::post("orders/statu/edit","OrdersController@statuEdit");

		// 评论管理
			Route::get('comment',"CommentController@index");
			Route::post('comment/ajaxStatu',"CommentController@ajaxStatu");





	// 获取标签
	Route::post('/goods/attr','GoodsController@Attrs');

	//标签属性添加
	Route::get('tags/addAttr/{id}','TagsController@addAttr');
	Route::post('/tags/insertAttr','TagsController@insertAttr');


	//标签属性展示
	Route::get('tags/showAttr/{id}','TagsController@showAttr');



	//系统管理
	Route::resource('sys/config','ConfigController');


		// 轮播图管理/admin/sys/ajaxStatu
		Route::resource("sys/slider","SliderController");

		// 后台轮播图状态修改路由
		Route::post('sys/ajaxStatu','SliderController@ajaxStatu');

		// 后台广告
		Route::resource('sys/ads','AdsController');

		//修改广告状态
		Route::post('sys/adsStatus','AdsController@adsStatus');

		//分类广告
		Route::resource('sys/typeads',"TypeAdsController");
		

		
});


 //前台路由
    //zhuye
    Route::get('/','Home\IndexController@index');

    // 商品详情页面
	Route::get('/goods/{id}','Home\GoodsController@index');

	// 分类页面

	Route::get('/types/{id}','Home\TypesController@index');
	

	// 购物车页面

	Route::get("car","Home\CarController@index");

	// 加入购物车
	Route::get("addCar","Home\CarController@addCar");

	// 购物车ajax调整数量

	Route::post('CarAdd',"Home\CarController@CarAdd");
	Route::post('CarJian',"Home\CarController@CarJian");
	Route::post('CarDel',"Home\CarController@CarDel");


	// 结算页面

	Route::post("jiesuan","Home\CarController@jiesuan");

	// 生成订单

	Route::post("orders","Home\OrdersController@index");
	Route::get("orders/show","Home\OrdersController@index");

	// 支付路由

	Route::get("pay/{code}","Home\OrdersController@pay");
 // DB::listen(function($sql, $bindings, $time) {
 //                dump($sql);
 //            });


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 




       //用户
        Route::resource("/user","Home\UserController");
                //ajax用户手机号验证码
        Route::get("/userPhone","Home\UserController@phone");
                //ajax用户输入手机号,判断是都注册过
        Route::get("/userPhoneLogin","Home\UserController@phoneLogin");
                //验证登录信息
        Route::post("/userDoLogin","Home\UserController@doLogin");
                //用户注册
        Route::get("/userLogin","Home\UserController@login");


    //用户中心
        Route::resource("/userContent","Home\UserContentController");
            //加载修改用户资料
        Route::resource("/userContentdata","Home\UserContentdata");
                //验证邮箱
            Route::get("/emailjihuo","Home\UserContentdata@jihuo");
                //执行修改
            Route::post("/homealter","Home\UserContentdata@alter");
                 //加载用户的地址
             Route::post('/homealterAJAX',"Home\UserContentdata@ajax");
                //加载修改个人密码
             Route::resource("/userContentpwd","Home\UserContentpwd");
    //管理收货地址
        Route::resource("/userAddr","Home\AddrController");